package com.example.weather.Base;

import androidx.fragment.app.Fragment;

import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;

//xutils加载网络数据
//1.声明整体模块
//2.执行网络请求
public class BaseFragment extends Fragment implements Callback.CommonCallback<String> {
    public void loadData(String path){
        RequestParams requestParams = new RequestParams(path);
        x.http().get(requestParams,this);
    }
//获取数据成功回调的接口
    @Override
    public void onSuccess(String result) {

    }
    //获取数据失败回调的接口
    @Override
    public void onError(Throwable ex, boolean isOnCallback) {

    }
//取消请求时回调的接口
    @Override
    public void onCancelled(CancelledException cex) {

    }
//请求完成时回调的接口
    @Override
    public void onFinished() {

    }
}
